import { BaseService, CoolCommException } from "@cool-midway/core";
import { Inject, Provide } from "@midwayjs/core";
import { Equal, Repository } from "typeorm";
import { ProviderPartnerEntity } from "../entity/partner";
import { InjectEntityModel } from "@midwayjs/typeorm";
import { ProviderTeamEntity } from "../entity/team";
import { Context } from "@midwayjs/koa";

import { ProviderProfileEntity } from "../entity/profile";
import { CapacityEntity } from "../../transport/entity/capacity";

@Provide()
export class ProviderPartnerService extends BaseService {

    @InjectEntityModel(ProviderPartnerEntity)
    providerPartnerEntity: Repository<ProviderPartnerEntity>

    @Inject()
    ctx: Context

    @InjectEntityModel(ProviderTeamEntity)
    providerTeamEntity: Repository<ProviderTeamEntity>

    @InjectEntityModel(ProviderProfileEntity)
    providerProfileEntity: Repository<ProviderProfileEntity>


    /**
     * 创建合作关系
     * @param providerId 服务人员ID
     * @param teamId 团队ID
     */
    async createPartner(providerId: number, teamId: number) {
        return this.providerPartnerEntity.save({
            providerId,
            teamId,
        });
    }

 
}